package com.nbgroup.pojo.common;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

@Data
@Builder
@AllArgsConstructor
public class PageBean {
    private Long total;
    private List rows;
    private Integer code; //编码：1成功，0为失败
    private String msg; //错误信息
    private Object params;

    public static PageBean success() {
        PageBean result = new PageBean();
        result.code = 200;
        result.msg = "操作成功";
        return result;
    }

    public PageBean() {
        this.code = 200;
        this.msg = "操作成功";
    }

    public static PageBean success(Object object) {
        PageBean result = new PageBean();
        result.code = 200;
        result.msg = "操作成功";
        return result;
    }

    public static PageBean error(String msg) {
        PageBean result = new PageBean();
        result.msg = msg;
        result.code = 0;
        return result;
    }

}
